package com.example.demo;

import com.deliveredtechnologies.rulebook.FactMap;
import com.deliveredtechnologies.rulebook.NameValueReferableMap;
import com.deliveredtechnologies.rulebook.lang.RuleBookBuilder;
import com.deliveredtechnologies.rulebook.model.RuleBook;
import java.util.ArrayList;

/**
 * @author lizhien (zhien.li@nascent.cn)
 * @version 1.0.0
 * @date 2022/3/18 16:02
 * @description com.example.demo
 */
public class CartPromotionRule {

    public static void main(String args) {
        RuleBook cartPromotion = RuleBookBuilder.create(ShoppingCartRule.class)
            .withResultType(Double.class)
            .withDefaultResult(0.0)
            .build();
        NameValueReferableMap facts = new FactMap();
        facts.setValue("cart", new Cart(450.0, 123456, new Customer(), new ArrayList()));
        cartPromotion.run(facts);
    }
}
